const path = require('path');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');

const serverConfig = {
    host: '127.0.0.1',
    port: 8080
};

const webpackDevConfig = {
    mode: 'development',
    devtool: 'eval-cheap-module-source-map',
    output: {
        publicPath: '/'
    },
    devServer: {
        host: serverConfig.host,
        port: serverConfig.port,
        compress: true,
        publicPath: '/',
        contentBase: path.join(__dirname, './dist'),
        quiet: true,
        overlay: {
            warnings: false,
            errors: true
        }
    },
    module: {},
    plugins: [
        new FriendlyErrorsPlugin({
            compilationSuccessInfo: {
                messages: [`Your application is running here: http://${serverConfig.host}:${serverConfig.port}`]
            }
        })
    ]
};

module.exports = webpackDevConfig;